<%@ page import="com.model.Goods" %>
<%@ page import="com.model.User" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/11/26
  Time: 13:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<%
    Boolean isOnline;
    User user = (User) session.getAttribute("user");
    String user_name = null;
    if(user == null){
        isOnline=false;
    }
    else {
        isOnline = true;
        user_name = user.getUserName();
    }
%>
<%
    String goodsName = null;
    String goodsPrice = null;
    String goodsDescribe = null;
    String photo_address = null;
    String goodsId = null;
    Goods goods = (Goods) request.getAttribute("goods");
    if(goods!=null) {
        goodsName = goods.getGoods_name();
        goodsPrice = goods.getGoods_price();
        goodsDescribe = goods.getGoods_describe();
        photo_address = goods.getPhoto_address();
        goodsId = goods.getGoods_id();

    }
%>
<head lang="en">
    <meta charset="UTF-8">
    <title><%= goodsName%></title>
    <link href="/store/css/goods.css" rel="stylesheet">
    <link href="/store/css/head.css" rel="stylesheet">
    <script language="JavaScript">
        var isOnline= <%= isOnline%> ;
        var username="<%= user_name%>";
    </script>
    <script language="JavaScript" src="/store/js/jquery-3.2.1.min.js"></script>
    <script language="JavaScript" src="/store/js/head.js"></script>
    <script language="JavaScript" src="/store/js/goods.js"></script>

</head>
<body>
<header>
    <jsp:include page="head.jsp"></jsp:include>
</header>
<div class="goods_msg">
    <div class="goods_img">
        <img src="<%= photo_address%>">
    </div>
    <div class="goods_args">
        <span class="goods_name"><%= goodsName%></span>
        <div class="goods_introduce">
            <%= goodsDescribe%>
        </div>
        <span class="goods_price">价格：<span>￥<%= goodsPrice%></span></span>
        <div class="goods_buy">
            <form name="buy" action="/store/shoppingcart.do" method="get">
                <label>
                    <span class="num">数量</span>
                    <input type="text" id="num" name="goods_num" value="1">
                    <span class="add_num">
                            <img class="top_img" src="/store/image/up.png">
                            <img class="bottom_img" src="/store/image/down.png">
                        </span>
                    <span class="unit">件</span>
                </label>
                <div class="goods_submit">
                    <input type="submit" class="put_goods" value="加入购物车">
                    <input type="text" value="add" name="action" STYLE="visibility: hidden">
                    <input type="text" value="<%= goodsId%>" name="goodsId" STYLE="visibility: hidden">
                </div>

            </form>
            <form name="buy_goods" action="" method="get">
                <input type="text" id="num2" name="goods_num2" value="1" style="visibility: hidden;width: 0;height: 0">
                <input type="submit" class="take_goods" value="立即购买">
                <input type="text" value="add" name="action" STYLE="visibility: hidden">
                <input type="text" value="<%= goodsId%>" name="goodsId" STYLE="visibility: hidden">
            </form>
        </div>
    </div>

</div>
</body>
</html>